package crudfx.util;
import javafx.animation.*;
import java.lang.*;
/**
 * @profile desktop
 * @author Sergey Surikov
 */
public class Decanter {
    public var time:Duration=0.1s;
    var queue:Number=0;
    public function add(action:function():Void):Void{
        queue=Math.random();
        Timeline{
            repeatCount:1
            keyFrames:KeyFrame{
                time:time
                var q=queue;
                action:function():Void{
                    if(q==queue){
                        //println("do queue {q}");
                        action();
                        }
                    else{
                        //println("skip queue {q}");
                        }
                    }
                }
            }.play();
        }
    }
